import axios from 'axios';

/**
 * 获取手机验证码
 * @param cellphone 手机号码
 */
export function getVerificationCode(cellphone) {
  return axios.get(`/register/security_code?cellphone=${cellphone}`);
}

/**
 * 获取地区信息
 * @param geoId
 * @returns {{res, content}|String}
 */
export function getAreaByGeoId(geoId) {
  return axios.get(`/area?geoId=${geoId}`);
}

/**
* 注册新用户和邀请码注册
* @param jsonBody
*/
export function register(jsonBody, inviteCode) {
  if (inviteCode) {
    return axios.post(`/register?inviteCode=${inviteCode}`, jsonBody);
  }
  return axios.post('/register', jsonBody);
}

/**
 * 获取排行榜（推广）
 */

export function getPropagationList() {
  return axios.get('/ranking_lists/propagation');
}

/**
 * 获取排行榜（奖金）
 */

export function getRewardList() {
  return axios.get('/ranking_lists/reward');
}

/**
 * 获取用户信息
 */
export function getUserInfo() {
  return axios.get('/users/me');
}
